Add helper accessor to return final time slice#315
Conversation
This returns the final time slice of a dataset or dataarray, whether the data contains multiple time slices or not. This is helpful when working with multiple simulations, some of which may have only been run for one timestep for developer reasons.
|
Could also add a |
I think there's already something like |
|
I have tried to use the existing tools and also found them flaky and slow. Instead, I have a very useful function called |
|
@ZedThree the tests are failing on a segfault, which is not to do with this PR I don't think. Can we merge this in? |
|
The linting error should be easily fixable. |
This returns the final time slice of a Dataset or DataArray whether the data contains multiple time slices or not. This is helpful when working with multiple simulations, some of which may have only been run for one timestep for developer reasons.
Here is how this can be done with built-in Xarray functionality right now - let's say we are reading in a 1D model, want to get the final timeslice whether the dataset contains time or not, and then snip off guard cells:
With this PR we can now do: